import Vue from 'vue'
import VueRouter from 'vue-router'
// 首先将页面导入进来
import Home from '../views/Home'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/home'
  },
  {
    path: '/home',
    component: () => import('@/views/Home.vue'),
    name: 'home'
  },
  {
    path: '/cate/:id',
    component: () => import('@/views/Category.vue'),
    name: 'category'
  },
  {
    path: '/course/:id',
    component: () => import('@/views/Course.vue'),
    name: 'course'
  },
  {
    path: '/login',
    component: () => import('@/views/Login.vue'),
    name: 'login'
  },

]

const router = new VueRouter({
  mode:'history',
  routes
})

export default router
